package com.moli.lumpSugar.websocket.service.adapter;


import com.moli.lumpSugar.api.domain.entity.user.User;
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;

public class UserAdapter {
    public static User buildUserSave(String openId)
    {
        return User.builder().openId(openId).build();
    }

    public static User buildAuthorizeUser(Long uid,WxOAuth2UserInfo wxUserInfo) {
        User user = new User();
        user.setName(wxUserInfo.getNickname());
        user.setAvatar(wxUserInfo.getHeadImgUrl());
        user.setOpenId(wxUserInfo.getOpenid());
        user.setSex(wxUserInfo.getSex());
        user.setId(uid);
        return user;

    }
}
